package nz.helloworld;

import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;

public class TestTexts extends JFrame {

	private JLabel label = new JLabel("Status");
	private JTextField textField;
	private JPasswordField pwdField;
	private JTextArea textArea;

	public TestTexts() {
		super("Test Texts");
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.getContentPane().setLayout(new FlowLayout());

		textField = new JTextField(15);
		textField.addCaretListener(new CaretListener() {

			@Override
			public void caretUpdate(CaretEvent arg0) {
				label.setText(textField.getText());
			}
		});
		pwdField = new JPasswordField(15);
		pwdField.setEchoChar('#');
		textArea = new JTextArea(5, 15);
		textArea.setLineWrap(true);

		this.getContentPane().add(textField);
		this.getContentPane().add(pwdField);
		this.getContentPane().add(textArea);
		this.getContentPane().add(label);

		this.setResizable(false);
		this.setSize(200, 220);
	}

	public static void main(String[] args) {
		TestTexts tt = new TestTexts();
		tt.setVisible(true);
	}

}
